<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;

/**
 * @property bool $scene 使用场景:1=指定商品,2=全场通用
 * @property bool $type 券类型:1=满减,2=无门槛
 * @property float $amount 优惠金额
 * @property float $with_amount 满足金额
 * @property int $expire_day 领取失效天数
 * @property int $goods_id 指定商品
 * @property int $id
 * @property int $num 券数量
 * @property string $createtime
 * @property string $mark 备注
 * @property string $name 券名称
 * @property-read mixed $scene_text
 * @property-read mixed $type_text
 * @mixin \think\Model
 */
class GoodsCoupon extends Model
{
	protected $createTime = 'createtime';
	

	protected $append = [
		'scene_text',
		'type_text'
	];
	
	public function getTypeTextAttr($value, $data)
	{
		$value = $value ? $value : ($data['type'] ?? '');
		$list = ['1' => '满减', '2' => '无门槛'];
		return $list[$value] ?? '';
	}
	
	function getSceneTextAttr($value, $data)
	{
		$value = $value ? $value : ($data['type'] ?? '');
		$list = ['1' => '指定商品', '2' => '全场通用'];
		return $list[$value] ?? '';
	}
	

}
